home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Camelot
/
Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip
/
Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf
/
XLisp-Stat
/
Book
/
regsensitivity.lsp
< prev
next >
Wrap
Text File
|
1990-10-11
|
1KB
|
35 lines
; book pp.307-308
(setf x (append (iseq 1 18) (list 30 40)))
(setf y (+ x (* 2 (normal-rand 20))))
(setf w (plot-points x y))
(send w :add-mouse-mode 'point-moving
:title "Point Moving"
:cursor 'finger
:click :do-point-moving)
(defmeth w :do-point-moving (x y a b)
(let ((p (send self :drag-point x y :draw nil)))
(if p (send self :set-regression-line))))
(defmeth w :set-regression-line ()
(let ((coefs (send self :calculate-coefficients)))
(send self :clear-lines :draw nil)
(send self :abline (select coefs 0) (select coefs 1))))
(defmeth w :calculate-coefficients ()
(let* ((i (send self :points-showing))
(x (send self :point-coordinate 0 i))
(y (send self :point-coordinate 1 i))
(m (regression-model x y :print nil)))
(send m :coef-estimates)))
(defmeth w :adjust-screen ()
(if (send self :needs-adjusting)
(send self :set-regression-line))
(call-next-method))
(send w :set-regression-line)
(send w :mouse-mode 'point-moving)